//配置地图
const state = {
  validTime: null,
  showQuickEnter: false, //后续迁移完使用该state来控制 快捷入口是否显示
  timer: null, //
};
const mutations = {
  SET_VALID_TIME(state, payload) {
    state.validTime = payload;
    state.timer = setTimeout(() => {
      state.validTime = null;
      if (self != top) {
        top.$('#intelligentQuickEnter').addClass('hide');
      }
    }, payload);
  },
  SET_QUICK_ENTER_STATUS(state, payload) {
    state.showQuickEnter = payload;
    if (self != top) {
      top.$('#intelligentQuickEnter').removeClass('hide');
      let num = 6;
      let timer = setInterval(() => {
        console.log('倒计时');
        --num;
        if (num < 0) {
          timer && clearInterval(timer);
          localStorage.setItem('alreadyShowEnterExplain', true);
          top.$('#intelligentQuickEnter').find('.firstHintWapper').remove();
        } else {
          top.$('#intelligentQuickEnter').find('.cutdownNum').html(`${num}s`);
        }
      }, 1000);
    }
  },
  RESET_VALID_TIME(state) {
    state.validTime = null;
    state.timer && clearTimeout(state.timer);
    state.timer = null;
    if (self != top) {
      top.$('#intelligentQuickEnter').removeClass('hide');
    }
  },
};
const actions = {};
const getters = {};

export default {
  namespaced: true, //开启命名空间，更好的区分使用stage,防止不同stage模块中的方法重名
  state,
  getters,
  mutations,
  actions,
};
